home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 February: Technology Seed / Mac Tech Seed Feb '97.toast / ODF Release 3 / ODF-Interest Archive / December 96 / Memory Containers & embedding.1 < prev    next >
Encoding:
Internet Message Format  |  1997-01-02  |  2.1 KB  |  [TEXT/ttxt]

  1. Subject:     Memory Containers & embedding.
  2. Sent:        12/20/96 2:30 PM
  3. Received:    12/20/96 3:03 PM
  4. From:        Paul Mylchreest, paulm@teamsoft.com
  5. Reply-To:    ODF Interest, ODF-Interest@CILabs.ORG
  6. To:          OpenDoc Development Framework Discussion List, ODF-Interest@CILabs.
  7.  
  8. Dear ODF Community,
  9.  
  10. I have overriden FW_CEmbeddingDataInterchange::InternalizeData() to deal
  11. with the problem of storing parts into a database.  The code below shows
  12. how I accomplish this by first cloning into a memory container and adding
  13. it to my database.  This works, for I can then copy the info from the
  14. database into a ODFDraw document.
  15.  
  16. FW_EInternalizeResult CMemContainerDataInterchange::InternalizeData(
  17.         Environment* ev, 
  18.         FW_CContent* content,
  19.         FW_CFrame* scopeFrame,
  20.         ODStorageUnit* sourceSU,
  21.         FW_StorageKinds storageKind, 
  22.         ODCloneKind cloneKind,
  23.         ODPasteAsResult* embedAsInfo)
  24. {
  25.     FW_EInternalizeResult
  26.         result = FW_kInternalizeFailed;
  27.  
  28.     ObjectId
  29.         theObjectID = 0;
  30.  
  31.     {
  32.         CMemoryContainer
  33.             memoryContainer(ev, sourceSU->GetSession(ev));
  34.  
  35.         if (memoryContainer.CloneFrom(ev, scopeFrame, sourceSU, cloneKind))
  36.         {
  37.             // Store in database.
  38.             theObjectID =  AddObject(&memoryContainer);
  39.             result = FW_kInternalizePart;
  40.         }
  41.     }
  42.  
  43.     if (theObjectID != 0)
  44.     {
  45.         CMemoryContainer
  46.             *pMemoryContainer = GetObject(ev, sourceSU->GetSession(ev),
  47. theObjectID);
  48.  
  49.         FW_ASSERT(pMemoryContainer);
  50.  
  51.         //    Embed.
  52.         pMemoryContainer->Open(ev);
  53.         {
  54.             ODDraft
  55.                 *sourceDraft = pMemoryContainer->GetDraft();
  56.  
  57.             FW_CAcquiredODStorageUnit
  58.                 memSU = sourceDraft->AcquireDraftProperties(ev);
  59.  
  60.             result = FW_CEmbeddingDataInterchange::InternalizeData(
  61.                     ev, 
  62.                     content,
  63.                     scopeFrame,
  64.                     memSU,
  65.                     storageKind, 
  66.                     cloneKind,
  67.                     embedAsInfo);
  68.         }
  69.         pMemoryContainer->Close(ev);
  70.     }
  71.  
  72.     return result;
  73. }
  74.  
  75. Now, my problems begin when I try to retrieve the previously stored part
  76. from the database and embedding it in my part: it is embedded allright, but
  77. the editor is of unknown type.
  78.  
  79. How is this possible? Any comments or suggestions would be kindly
  80. appreciated.
  81.  
  82. Thanks,
  83.  
  84. ________________
  85. Paul Mylchreest
  86. Teamsoft Inc.
  87. Montreal, Quebec, Canada
  88. http://teamsoft.com
  89.  
  90.  
  91.  
  92.